{% macro studyplan_tree(studyplans) %}
    {% if studyplans is not empty %}
    <ol class="dd-list">
        {% for studyplan in studyplans %}
            <li class="dd-item  dd-collapsed" data-id="{{ studyplan['id'] }}">
                <div class="dd-handle">
                    <strong>{{ studyplan['name']|raw }}</strong>
                    <span class="pull-right dd-nodrag">

                {% if is_authorized('admin_teach_studyplan_edit') %}
                    <a href="{{ path("admin_teach_studyplan_edit", {"id":studyplan['id']}) }}" data-width="1000px" data-title="编辑"  title="编辑" class="poppage"><i class="mdi mdi-file-document-edit"></i></a>
                {% endif %}

                        {% if is_authorized('admin_api_teach_studyplan_switchStatus') %}
                            {% if studyplan['status'] == 1 %}
                                <a href="{{ path("admin_api_teach_studyplan_switchStatus", {"id":studyplan['id']}) }}" title="下架"  data-confirm="确认要下架吗?" class="ajaxDelete"><i class="mdi mdi-toggle-switch"></i></a>
                    {% else %}
                                <a href="{{ path("admin_api_teach_studyplan_switchStatus", {"id":studyplan['id']}) }}" title="上架"  data-confirm="确认要上架吗?" class="ajaxDelete"><i class="mdi mdi-toggle-switch-off"></i></a>
                            {% endif %}
                        {% endif %}


                        {% if is_authorized('admin_api_teach_studyplan_delete') %}
                            <a href="{{ path("admin_api_teach_studyplan_delete", {"id":studyplan['id']}) }}" title="删除"  data-confirm="确认要删除吗?" class="tree_branch_delete ajaxDelete"><i class="mdi mdi-delete"></i></a>
                        {% endif %}
                    </span>
                    {% if studyplan['applyedAt'] %}
                    <span class='font-weight-lighter' style="margin-left: 20px; color: #999">报名时间：{{ studyplan['applyedAt']|date('Y-m-d H:i') }}</span>
                    {% endif %}
                    <span class='font-weight-lighter' style="margin-left: 20px; color: #999">有挡板?：{{ studyplan['isBlock']?"是":"否" }}</span>
                    <span class='font-weight-lighter' style="margin-left: 20px; color: #999">默认?：{{ studyplan['isDefault']?"是":"否" }}</span>
                </div>
                {% if studyplan['sub'] is not empty %}
                <ol class="dd-list">
                    {% for sub in studyplan['sub'] %}
                        <li class="dd-item  dd-collapsed" data-id="{{ sub['id'] }}">
                            <div class="dd-handle">
                                {{ loop.index }}.&nbsp;<strong>{{ sub['course']['name']|raw }}</strong>
                                <span class="pull-right dd-nodrag">
                                    {% if is_authorized('admin_api_teach_studyplansub_delete') %}
                                        <a href="{{ path("admin_api_teach_studyplansub_delete", {"id":sub['id']}) }}" title="删除"  data-confirm="确认要删除吗?" class="tree_branch_delete ajaxDelete"><i class="mdi mdi-delete"></i></a>
                                    {% endif %}
                                </span>
                            </div>

                        </li>
                    {% endfor %}
                </ol>
                {% endif %}
            </li>
        {% endfor %}
    </ol>
    {% endif %}
{% endmacro %}
